<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Linkslistsshorts extends Model
{
    protected $table = 'links_lists_shorts';
    protected $primaryKey = 'id';

    public static function getLinksListsId($short_id)
    {
        return self::select("links_lists.created_at","links_lists_shorts.links_id")->leftJoin('links_lists', 'links_lists_shorts.links_id', '=', 'links_lists.links_id')->where('links_lists_shorts.short_id', $short_id)->first();
    }

    public static function getLinksListsShorts($links_id)
    {
        return self::where('links_id', $links_id)->first();
    }

    public static function insertLinksListsShort($links_id,$short_id,$created_at)
    {
        return self::insert(["links_id"=>$links_id,"short_id"=>$short_id,"created_at"=>$created_at]);
    }
}
